package com.shop.seller.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.commons.beanutils.BeanUtils;
import org.springframework.stereotype.Service;

import com.shop.domain.CustomTypeTemplate;
import com.shop.mapper.TypeTemplateMapper;
import com.shop.model.TypeTemplate;
import com.shop.model.TypeTemplateExample;
import com.shop.model.TypeTemplateExample.Criteria;
import com.shop.seller.service.TypeTemplateService;
/**
 * 模板接口实现类
 * @author Y
 *
 */
@Service("typeTemplateService")
public class TypeTemplateServiceBena implements TypeTemplateService{

	@Resource
	private TypeTemplateMapper typeTemplateMapper;

	@Override
	public CustomTypeTemplate findTypeTemplate(Long id) throws Exception {
		// TODO Auto-generated method stub
		TypeTemplateExample example=new TypeTemplateExample();
		Criteria criteria=example.createCriteria();
		criteria.andIdEqualTo(id);
		CustomTypeTemplate customTypeTemplate=new CustomTypeTemplate();
		List<TypeTemplate> typeTemplates=typeTemplateMapper.selectByExample(example);
		if(typeTemplates!=null && typeTemplates.size()>0)
		{
			BeanUtils.copyProperties(customTypeTemplate,typeTemplates.get(0));
		}
		
		return customTypeTemplate;
	}



	

	
	

}
